import type { ProColumnType } from "@ant-design/pro-components";
import React from "react";
import {
  levelOptionsValueEnum,
  notifierChoicesValueEnum,
  notifyChannelsValueEnum,
} from "./constants";

import { getNotifierChoicesDisplay } from "./dataFormat";
import { RiskRow } from "./interface";
import { Tooltip } from "antd";

export type RiskColumnType = ProColumnType<RiskRow>;

export const riskNameSearchColumn: RiskColumnType = {
  title: "预警指标名称",
  dataIndex: "name",
};
export const riskRuleNameSearchColumn: RiskColumnType = {
  title: "预警规则名称",
  dataIndex: "name",
};
export const riskRuleLevelColumn: RiskColumnType = {
  title: "预警等级",
  dataIndex: "level",
  search: false,
  valueEnum: levelOptionsValueEnum,
};

export const notifierChoicesColumn: RiskColumnType = {
  title: "通知人",
  search: false,
  dataIndex: "notifierChoices",
  valueEnum: notifierChoicesValueEnum,
  render: (_, record) => {
    return <Tooltip>{getNotifierChoicesDisplay(record)}</Tooltip>;
  },
};

export const notifyChannelsColumn: RiskColumnType = {
  title: "预警通知方式",
  dataIndex: "notifyChannels",
  search: false,
  valueEnum: notifyChannelsValueEnum,
};

export const riskTypeSearchColumn: RiskColumnType = {
  title: "预警类型",

  dataIndex: "type",
};

export const riskSystemIdSearchColumn: RiskColumnType = {
  title: "预警模块",
  hideInTable: true,
  dataIndex: "systemId",
};

export const riskSystemNameColumn: RiskColumnType = {
  title: "预警模块",
  search: false,
  dataIndex: "systemName",
};

export const riskRemarkColumn: RiskColumnType = {
  title: "说明",
  search: false,
  width: 170,
  dataIndex: "remark",
  ellipsis: true,
};

export const riskBusNameColumn: RiskColumnType = {
  title: "业务类型",
  search: false,
  dataIndex: "busName",
};
export const riskStatusColumn: RiskColumnType = {
  title: "状态",
  search: false,
  dataIndex: "status",
};
